<?php
if($_REQUEST['act']&&$_REQUEST['act']=='del'){
$id=!empty($_REQUEST['id'])?$_REQUEST['id']: false;
if($id){
$linkDel=spClass(friend_link);
$linkDel->delete($conditons=array('link_id'=>$id));
echo'<script>alert(\'数据删除成功\');window.history.go(-1)</script>';
}else{
die('INVALID REQUEST');
}
}else if($_REQUEST['act']&&$_REQUEST['act']=='edit'){
$id=!empty($_REQUEST['id'])?intval($_REQUEST['id']): false;
if($id){
$linkEdit=spClass(friend_link);
$this->Datil=$linkEdit->find($conditons=array('link_id'=>$id));
$this->actionUrl='./index.php?c=admin&a=sysconfig&mod=link&act=save&id='.$id;
$this->display('management/link_info.html');
}else{
die('INVALID REQUEST');
}
}else if($_REQUEST['act']&&$_REQUEST['act']=='save'){
dump($this->spArgs());

}else if($_REQUEST['act']&&$_REQUEST['act']=='modify'){
	$id=$this->spArgs(id);
	$data=$this->spArgs(data);


}else{
$page= $_REQUEST['p'] ? $_REQUEST['p']:1;
$this->navi=array(
'subtitle'=>'友情链接管理',
);
$this->action_link=array(
'href'=>$_SERVER[REQUEST_URI].'&act=add',
'text'=>'添加新链接',
);
$this->pageUrl=$_SERVER[REQUEST_URI];
$linkDatil=spClass(friend_link);
$config=admin::config();
$pagesize=$config[page];
$cache_time=$config[cache];
$this->Datil=$linkDatil->spPager($this->spArgs('page', $page),$pagesize)->findAll();
$this->pager=$linkDatil->spPager()->getPager();
$this->display('management/link_list.html');	
}